package com.dks.controller;

import com.dks.models.TextDetail;
import com.dks.repository.ITextDetailRepository;
import com.dks.result.ResultModel;
import com.dks.util.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 学生班级相关
 */
@RestController
@RequestMapping("text_detail")
public class TextDetailController {

    @Resource
    private ITextDetailRepository TextDetailRepository;

    /**
     * 提交时间段
     *
     * @param TextDetail 记录
     * @author zn
     */
    @PostMapping("insert")
    public ResultModel<Boolean> insert(@RequestBody TextDetail TextDetail) {
        return TextDetailRepository.insert(TextDetail);
    }

    /**
     * 修改记录
     *
     * @param TextDetail id 课程系列id
     * @author zn
     */
    @PostMapping("update")
    public ResultModel<Boolean> update(@RequestBody TextDetail TextDetail) {
        return TextDetailRepository.update(TextDetail);
    }


    /**
     * id查找
     * @param type: 1 主页详情，2  轮播内容
     * @author zn
     */
    @GetMapping("selectByType")
    public ResultModel<PageInfo<TextDetail>> selectByType(@Param("type") Integer type) {
        return TextDetailRepository.selectByType(type);
    }



}
